package com.example.demo01.Socket.Server;

import com.example.demo01.Socket.Server.NettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


@Component
@Slf4j
public class NettyBooter implements ApplicationListener<ContextRefreshedEvent> {


    @Resource
    private NettyServer nettyServer;
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {

        try {
            nettyServer.start();
        } catch (Exception e) {
            log.error("error",e);
        }
    }
}
